package xrz.cuanbao.utils;

import java.util.List;

import org.litepal.crud.DataSupport;
import org.xutils.common.util.LogUtil;

import android.net.Uri;
import io.rong.imkit.RongIM.UserInfoProvider;
import io.rong.imlib.model.UserInfo;
import xrz.cuanbao.entitys.Others;

public class RongProvider implements UserInfoProvider{

	@Override
	public UserInfo getUserInfo(String userid) {
		List<Others> list = DataSupport.where("userid=?", userid).find(Others.class);
		if(list != null && list.size() != 0){
			Others others = list.get(0);
			String nickname = others.getNickname() == null || others.getNickname().equals("null") ? others.getUsername() : others.getNickname();
			return new UserInfo(others.getUserid(),nickname, Uri.parse(others.getAvatar()));
		}
		return null;
	}

}
